<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        padding: 0;
        margin: 0;
      }
      .box {
        width: 1200px;
        overflow: hidden;
        margin: 10px auto;
      }
      .box ul {
        list-style: none;
      }
      .box ul li {
        float: left;
        width: 380px;
        height: 210px;
        margin-right: 20px;
        position: relative;
      }
      .box ul li:hover .info {
        opacity: 1;
      }
      .box ul li .info {
        position: absolute;
        width: 370px;
        height: 30px;
        padding-left: 10px;
        background-color: rgba(0, 0, 0, 0.5);
        bottom: 0;
        text-align: center;
        line-height: 30px;
        color: white;
        /* 透明度为0 */
        opacity: 0;
        /* 过渡 */
        transition: opacity 1s ease 0s;
      }
      .box ul li img {
        width: 380px;
        height: 210px;
      }
    </style>
  </head>
  <body>
    <div class="box">
      <ul>
        <li>
          <img src="./images/0.jpg" alt="" />
          <div class="info">北京的故宫</div>
        </li>
        <li>
          <img src="./images/1.jpg" alt="" />
          <div class="info">北京的故宫</div>
        </li>
        <li>
          <img src="./images/2.jpg" alt="" />
          <div class="info">北京的故宫</div>
        </li>
      </ul>
    </div>
  </body>
</html>
